﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PredmetiSeznam.aspx.cs" Inherits="Sio.Mdm.Web.Instalacija.PredmetiSeznam" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>SIO - MDM :: Instalacija : Predmeti</title>
<ext:XScript ID="XScript1" runat="server">
  <script type="text/javascript">
    var dodajZapis = function () {
      var grid = #{GridSplosniSeznam};
      grid.getRowEditor().stopEditing();    
      grid.insertRecord(0, {
          PredmetId: -99,
			    PolnoIme   : "",
      });
      
      grid.getView().refresh();
      grid.getSelectionModel().selectRow(0);
      grid.getRowEditor().startEditing(0);
    }
</script>
    </ext:XScript>
</head>
<body>
    <form id="form1" runat="server">
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    
    <ext:Viewport ID="Viewport1" runat="server" Layout="Fit">
    <Content>
		                    
		<sio:GridPanel ID="GridSplosniSeznam" runat="server" 
			StripeRows="true"
			TrackMouseOver="true">
     <Plugins>
         <ext:RowEditor ID="RowEditor1" runat="server" SaveText="Shrani" CancelText="Prekliči">
            <DirectEvents>
                <AfterEdit OnEvent="UrediPodatke">
									<ExtraParams>
										<ext:Parameter Mode="Raw" Name="data" Value="r.data" />
									</ExtraParams>
								</AfterEdit>
            </DirectEvents>
		</ext:RowEditor>         
		<ext:GridFilters ID="GridFilters1" runat="server">
		<Filters>
			<ext:NumericFilter DataIndex="PredmetId" />
			<ext:StringFilter DataIndex="PolnoIme" />			
			<ext:StringFilter DataIndex="Kratica" />
			<ext:StringFilter DataIndex="ImeZaIzpis" />
		</Filters>
		</ext:GridFilters>		
      </Plugins>			
		<Store>
			<ext:Store ID="StoreSplosniSeznam" runat="server">
			<SortInfo Field="PolnoIme" />
			<Reader>
				<ext:JsonReader IDProperty="PredmetId">
					<Fields>
						<ext:RecordField Name="PredmetId" Type="Int" />
						<ext:RecordField Name="PolnoIme" Type="String" />
						<ext:RecordField Name="Kratica" Type="String" />
						<ext:RecordField Name="ImeZaIzpis" Type="String" />
						<ext:RecordField Name="VeljavnostOd" Type="Date" />
						<ext:RecordField Name="VeljavnostDo" Type="Date" />
					</Fields>
				</ext:JsonReader>
			</Reader>
			</ext:Store>			
		</Store>
	    
		<ColumnModel ID="ColumnModel1" runat="server">
		<Columns>
			<ext:RowNumbererColumn />
			<ext:Column ColumnID="PredmetId" Hidden="true" Hideable="false" DataIndex="PredmetId"></ext:Column>
			<ext:Column ColumnID="PolnoIme" Header="Polni naziv predmeta" DataIndex="PolnoIme" Width="150">
        <Editor><ext:TextField ID="TextField1" runat="server" AllowBlank="false" MinLength="2" MinLengthText="Vpišite polni naziv predmeta" BlankText="Vpišite polni naziv predmeta" /></Editor>
      </ext:Column>
			<ext:Column ColumnID="Kratica" Header="Kratica" DataIndex="Kratica" Width="50">
        <Editor><ext:TextField ID="TextField2" runat="server" AllowBlank="true" /></Editor>
      </ext:Column>
			<ext:Column ColumnID="ImeZaIzpis" Header="Ime za izpis" DataIndex="ImeZaIzpis" Width="150">
        <Editor><ext:TextField ID="TextField3" runat="server" AllowBlank="true" /></Editor>
      </ext:Column>
			<ext:DateColumn Format="dd.MM.yyyy" ColumnID="VeljavnostOd" Header="Veljavnost od" DataIndex="VeljavnostOd" Width="100">
        <Editor><ext:DateField ID="DateField1" runat="server" AllowBlank="true" /></Editor>
      </ext:DateColumn>
			<ext:DateColumn Format="dd.MM.yyyy" ColumnID="VeljavnostDo" Header="Veljavnost do" DataIndex="VeljavnostDo" Width="100">
        <Editor><ext:DateField ID="DateField2" runat="server" AllowBlank="true" /></Editor>
      </ext:DateColumn>
		</Columns>
		</ColumnModel>
		
		<SelectionModel>
			<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" />
		</SelectionModel>
		
		<TopBar>
			<ext:Toolbar ID="Toolbar1" runat="server" Width="500">
			<Items>
				<sio:Button ID="Button1" runat="server" Text="Dodaj" Icon="Add">
				<Listeners>
							<Click Fn="dodajZapis" />
          </Listeners>
				</sio:Button>
				<sio:Button ID="Button3" runat="server" Text="Briši" Icon="Delete">
        <DirectEvents>
					<Click OnEvent="OdstraniZapise" After="#{StoreSplosniSeznam}.reload();" >
					<Confirmation ConfirmRequest="true" Message="Izbrišem izbrane predmete?" />
					<ExtraParams>
						<ext:Parameter Name="selected" Mode="Raw" Value="Ext.encode(#{GridSplosniSeznam}.getRowsValues({selectedOnly:true}))" />
					</ExtraParams>					
					</Click>
				</DirectEvents>	
				</sio:Button>
			</Items>
			</ext:Toolbar>
		</TopBar>
		
		</sio:GridPanel>
    
	</Content>
	</ext:Viewport>
    </form>
</body>
</html>

